package model;

import java.io.Serializable;
import java.util.UUID;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;

@Entity
@NamedQuery(name= "Role.findRoleByPassenger", query="select r from Role r where r.passenger = :passenger")
public class Role implements Serializable {
	
	public static final String FIND_BY_PASSENGER = "Role.findRoleByPassenger";
	
	public Passenger getPassenger() {
		return passenger;
	}

	public void setPassenger(Passenger passenger) {
		this.passenger = passenger;
	}

	public int getRoleID() {
		return roleID;
	}

	public void setRoleID(int roleID) { 
		this.roleID = roleID;
	}

	private static final long serialVersionUID = 1L;
	
	@Id
	private int roleID = Math.abs(UUID.randomUUID().hashCode());
	
	private String authority;

	public String getAuthority() {
		return authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}
	
	@OneToOne
	@JoinColumn(name="passengerID")
	private Passenger passenger;
	
}
